import java.util.ArrayList;

import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import it.randomtower.engine.entity.Entity;


class GUIGUI extends Entity{

	Button Attack = new Button("Attack");
	Button Move = new Button("Move");
	ArrayList<Button> Buttons = new ArrayList<Button>();
	private boolean isShown;
	Color red = new Color(1.0f,.0f,.0f);
	
	public GUIGUI(float x, float y) {
		super(x, y);
		Button Attack = new Button("Attack");
		Button Move = new Button("Move");
		Buttons.add(Attack);
		Buttons.add(Move);
		Attack.setWidth(50);
		Move.setWidth(50);
		isShown = true;
		// TODO Auto-generated constructor stub
	}
	
	public void showAttack(boolean x){
		Attack.setIsShown(x);
	}
	public void render(Graphics g, int x, int y) throws SlickException {
		g.setColor(red);
		g.fillRect(x, y, 80, Buttons.size() * 22);
		Attack.render(g, x, y+1);
		Move.render(g, x, y+23);
	}
	//TODO: Make the button clicks actually do something

	public boolean isShown() {
		return isShown;
	}
	
	public void setIsShown(boolean x){
		isShown = x;
	}
	
	public boolean update(Input input){
		boolean temp = false;
		for(Button b : Buttons){
			if(b.update(input)){
				temp = true;
				System.out.println("True Touch");
			}
		}
		return temp;
		
	}
	
	//Change this/Fix it
	public void setXAndYForButtons(int x, int y){
		int offset = 0;
		for(Button b: Buttons){
			b.setX(x);
			b.setY(y+offset);
			offset += 20;
		}
	}
	
}